#!/bin/bash
# Copyright (c) 2022 Institute of Software, Chinese Academy of Sciences (ISCAS)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

###
 # @Author: wenchao
 # @Date: 2021-12-09 10:25:41
 # @LastEditors: wenchao
 # @LastEditTime: 2021-12-15 15:35:22
 # @Description: 
### 

if [[ $# -lt 2 ]]; then
    echo "Usage: sh script/run.sh 192.168.10.29 22"
    exit
fi
host=$1
port=$2
exe="system-agent" && script/build_linux-arm64_bywin.bat && ssh -p $port root@$host systemctl stop system-agent && scp -P $port build/$exe root@$host:/usr/local/bin/ && ssh -p $port root@$host systemctl start system-agent
